<%@ page import="com.dao.GoodsDAO" %>
<%@ page import="com.model.Goods" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: 张爽
  Date: 2024/9/4
  Time: 15:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>药品管理系统</title>
    <link rel="stylesheet" href="css/home.css">
</head>
<body>
    <header>
        <h1>药品管理系统</h1>
        <nav>
            <ul>
                <li><a href="#home">首页</a></li>
                <li><a href="addGoods.jsp">添加药品</a></li>
                <li><a href="listGoods.jsp">查看药品</a></li>
                <li><a href="listorser.jsp">查看订单</a></li>
                <li><a href="#settings">设置</a></li>
                <li><a href="yhgl.jsp">用户管理</a></li>
            </ul>
        </nav>
    </header>

    <main>
        <section id="home">
            <h2>欢迎使用药品管理系统</h2>
            <p>这是一个用于管理药品信息的系统。</p>
        </section>


        <section id="view-drugs">
            <h2>查看药品</h2>
            <table>
                <thead>
                    <tr>
                        <th>药品ID</th>
                        <th>药品名称</th>
                        <th>药品价格</th>
                        <th>药品图片</th>
                        <th>药品详情</th>
                        <th>商品数量</th>
                    </tr>
                </thead>
                <tbody>
                <%
                    GoodsDAO goodsDAO = new GoodsDAO();
                    List<Goods> goodsList = goodsDAO.getAllGoods();
                    for (Goods goods : goodsList) {
                %>
                    <tr>
                        <td><%= goods.getId() %></td>
                        <td><%= goods.getName() %></td>
                        <td><%= goods.getPrice() %></td>
                        <td><a href="GoodsDetailServlet?id=<%= goods.getId() %>">
                            <img src="<%= request.getContextPath() %>/<%= goods.getImagePath() %>" width="100" height="100"></a></td>
                        <td><%= goods.getMark() %></td>
                        <td><%= goods.getQuantity() %></td>
                    </tr>
                <% } %>
                </tbody>
            </table>
        </section>

        <section id="settings">
            <h2>设置</h2>
            <p>这里是系统的一些基本设置。</p>
        </section>
    </main>

    <footer>
        <p>&copy; 2023 药品管理系统. All rights reserved.</p>
    </footer>
</body>
</html>
